package com.xingfudazi.web.controller.app;

import com.xingfudazi.app.domain.AppMessage;
import com.xingfudazi.app.domain.AppMoment;
import com.xingfudazi.app.dto.MemberAvatar;
import com.xingfudazi.app.enums.MessageEnum;
import com.xingfudazi.app.service.IAppMessageService;
import com.xingfudazi.common.core.domain.Result;
import com.xingfudazi.web.vo.AppMomentAvatarVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @author YuJiaMing
 * date 2024年06月22日 23:06
 */
@RestController
@RequestMapping("/app/message")
public class AppMessageController {

    @Autowired
    private IAppMessageService appMessageService;


    /**
     * 查询动态列表
     */
    @GetMapping("/turn")
    public Result<List<AppMessage>> turn(@RequestParam(defaultValue = "20") Integer pageSize,
                                         Long lastId, MessageEnum type) {
        return Result.success(appMessageService.turn(pageSize, lastId, type));
    }

    /**
     * 阅读消息
     */
    @PostMapping("read")
    public Result<?> read(Long id) {
        appMessageService.read(id);
        return Result.success();
    }


}
